package com.zhai.cloud.user.controller;

import com.zhai.cloud.common.domain.Result;
import com.zhai.cloud.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;

/**
 * @package: com.zhai.cloud.user.controller
 * @project-name: zhai-cloud
 * @description: //TODO 请对该类编写一个描述
 * @author: Created by 翟凤玺
 * @create-datetime: 2018/5/17 0017 15:14
 */
@RestController
public class UserController {

    @Autowired
    private DiscoveryClient discoveryClient;

    @PostMapping("/user")
    public Result findByUser(@RequestBody User user) {
        return Result.success(user);
    }

    @GetMapping("/instance-info")
    public ServiceInstance showInfo() {
        ServiceInstance localServiceInstance = discoveryClient.getLocalServiceInstance();
        return localServiceInstance;
    }

}
